CFLAGS = -Wall -fpic -coverage -lm

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

interface.o: interface.h interface.c 
	gcc -c interface.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)

testBuy: testBuy.c dominion.o rngs.o
	gcc -o testBuy -g  testBuy.c dominion.o rngs.o $(CFLAGS)

testGain: testGain.c dominion.o rngs.o
	gcc -o testGain -g  testGain.c dominion.o rngs.o $(CFLAGS)

testScore: testScore.c dominion.o rngs.o
	gcc -o testScore -g  testScore.c dominion.o rngs.o $(CFLAGS)

testAdventurer: testAdventurer.c dominion.o rngs.o
	gcc -o testAdventurer -g  testAdventurer.c dominion.o rngs.o $(CFLAGS)

testMine: testMine.c dominion.o rngs.o interface.o
	gcc -o testMine -g  testMine.c dominion.o rngs.o interface.o $(CFLAGS)

testRemodel: testRemodel.c dominion.o rngs.o
	gcc -o testRemodel -g  testRemodel.c dominion.o rngs.o $(CFLAGS)

testVillage: testVillage.c dominion.o rngs.o
	gcc -o testVillage -g  testVillage.c dominion.o rngs.o $(CFLAGS)

testInitialization: testInitialization.c dominion.o rngs.o interface.o
	gcc -o testInitialization -g  testInitialization.c dominion.o rngs.o interface.o $(CFLAGS)

testSystem:  testDominion.c dominion.o rngs.o interface.o
	gcc -o testdominion -g testDominion.c dominion.o rngs.o interface.o $(CFLAGS)


testAll:
	make testBuyFile
	make testGainFile
	make testScoreFile
	make testRemodelFile
	make testVillageFile
	make testMineFile
	make testAdventurerFile
	make testInitializationFile


testBuyFile: testBuy.c dominion.o rngs.o
	gcc -o testBuy -g  testBuy.c dominion.o rngs.o $(CFLAGS)
	testBuy >> testBuyFile.out
	echo "Test Buy gcov" >> testBuyFile.out
	gcov -b testBuy.c >> testBuyFile.out
	echo "Dominion gcov" >> testBuyFile.out 
	gcov -b dominion.c >> testBuyFile.out

testGainFile: testGain.c dominion.o rngs.o
	gcc -o testGain -g  testGain.c dominion.o rngs.o $(CFLAGS)
	testGain >> testGainFile.out
	echo "Test Gain gcov" >> testGainFile.out
	gcov -b testGain.c >> testGainFile.out
	echo "Dominion gcov" >> testGainFile.out
	gcov -b dominion.c >> testGainFile.out

testScoreFile: testScore.c dominion.o rngs.o
	gcc -o testScore -g  testScore.c dominion.o rngs.o $(CFLAGS)
	testScore >> testScoreFile.out
	echo "Test Score gcov" >> testScoreFile.out
	gcov -b testScore.c >> testScoreFile.out
	echo "Dominion gcov" >> testScoreFile.out
	gcov -b dominion.c >> testScoreFile.out

testAdventurerFile: testAdventurer.c dominion.o rngs.o
	gcc -o testAdventurer -g  testAdventurer.c dominion.o rngs.o $(CFLAGS)
	testAdventurer >> testAdventurerFile.out	
	echo "Test Adventure gcov" >> testAdventurerFile.out
	gcov -b testAdventurer.c >> testAdventurerFile.out
	echo "Dominion gcov" >> testAdventurerFile.out
	gcov -b dominion.c >> testAdventurerFile.out

testMineFile: testMine.c dominion.o rngs.o interface.o
	gcc -o testMine -g  testMine.c dominion.o rngs.o interface.o $(CFLAGS)
	testMine >> testMineFile.out
	echo "Test Mine gcov" >> testMineFile.out
	gcov -b testMine.c >> testMineFile.out
	echo "Dominion gcov" >> testMineFile.out
	gcov -b dominion.c >> testMineFile.out

testRemodelFile: testRemodel.c dominion.o rngs.o
	gcc -o testRemodel -g  testRemodel.c dominion.o rngs.o $(CFLAGS)
	testRemodel >> testRemodelFile.out
	echo "Test Remodel gcov" >> testRemodelFile.out
	gcov -b testRemodel.c >> testRemodelFile.out
	echo "Dominion gcov" >> testRemodelFile.out
	gcov -b dominion.c >> testRemodelFile.out

testVillageFile: testVillage.c dominion.o rngs.o
	gcc -o testVillage -g  testVillage.c dominion.o rngs.o $(CFLAGS)
	testVillage >> testVillageFile.out
	echo "Test Buy gcov" >> testVillageFile.out
	gcov -b testVillage.c >> testVillageFile.out
	echo "Dominion gcov" >> testVillageFile.out
	gcov -b dominion.c >> testVillageFile.out

testInitializationFile: testInitialization.c dominion.o rngs.o interface.o
	gcc -o testInitialization -g  testInitialization.c dominion.o rngs.o interface.o $(CFLAGS)
	testInitialization >> testInitializationFile.out
	echo "Test Initialization gcov" >> testInitializationFile.out
	gcov -b testInitialization.c >> testInitializationFile.out
	echo "Dominion gcov" >> testInitializationFile.out
	gcov -b dominion.c >> testInitializationFile.out

testSystemFile:  testDominion.c dominion.c rngs.c interface.c
	gcc -o testdominion -g testDominion.c dominion.c rngs.c interface.c $(CFLAGS)
	testdominion 2 >> testSystemFile.out
#echo "Test System gcov" >> testSystemFile.out
#gcov -b testDominion.c >> testSystemFile.out
#echo "Dominion gcov" >> testSystemFile.out
#gcov -b dominion.c >> testSystemFile.out


player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player 

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testDrawCard testDrawCard.exe testBuyCard testBuyCard.exe badTestDrawCard badTestDrawCard.exe *.gcov *.gcda *.gcno *.so

